<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}ExamPulse - 智能考研成绩分析系统{% endblock %}</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <!-- 自定义 Base 样式（马卡龙主题） -->
    <link rel="stylesheet" href="/static/users/css/base-style.css">
    {% block extra_css %}{% endblock %}
</head>
<body>
    <!-- 背景装饰（马卡龙漂浮效果，不影响功能） -->
    <div class="base-bg-decoration base-bg-pink"></div>
    <div class="base-bg-decoration base-bg-blue"></div>
    <div class="base-bg-decoration base-bg-green"></div>

    <!-- 导航栏：马卡龙色系 + 圆角 + 悬浮动画 -->
    <nav class="navbar navbar-expand-lg navbar-light base-nav">
        <div class="container">
            <!-- 【核心修复】品牌链接指向学生列表页面 -->
            <a class="navbar-brand base-brand" href="{% url 'users:student_list' %}">
                <i class="fas fa-graduation-cap me-2"></i>ExamPulse
            </a>
            <button class="navbar-toggler base-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <!-- 左侧导航菜单 -->
                <ul class="navbar-nav me-auto base-nav-list">
                    <li class="nav-item">
                        <!-- 修复：添加权限检查，只有管理员才显示学生管理链接 -->
                        {% if user.is_authenticated and user.is_superuser %}
                            <a class="nav-link base-nav-link" href="{% url 'users:student_list' %}">
                                <i class="fas fa-users me-1"></i>学生管理
                            </a>
                        {% endif %}
                    </li>
                    <!-- 可扩展其他菜单，样式自动继承 -->
                </ul>

                <!-- 右侧登录/登出入口 -->
                <ul class="navbar-nav base-user-menu">
                    {% if user.is_authenticated %}
                        <!-- 已登录：下拉菜单 -->
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle base-user-link" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-user me-1"></i>{{ user.username }}
                            </a>
                            <ul class="dropdown-menu dropdown-menu-end base-dropdown-menu">
                                <li>
                                    <a class="dropdown-item base-dropdown-item" href="{% url 'users:user_logout' %}">
                                        <i class="fas fa-sign-out-alt me-1"></i>退出登录
                                    </a>
                                </li>
                            </ul>
                        </li>
                    {% else %}
                        <!-- 未登录：登录按钮 -->
                        <li class="nav-item">
                            <a class="nav-link base-login-btn" href="{% url 'users:user_login' %}">
                                <i class="fas fa-sign-in-alt me-1"></i>登录
                            </a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <!-- 消息提示：马卡龙风格优化 -->
    {% if messages %}
    <div class="container mt-3 base-alert-container">
        {% for message in messages %}
        <div class="alert base-alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
            <i class="fas
                {% if message.tags == 'success' %}fa-check-circle me-2{% elif message.tags == 'danger' %}fa-exclamation-circle me-2{% else %}fa-info-circle me-2{% endif %}"
            ></i>
            {{ message }}
            <button type="button" class="btn-close base-alert-close" data-bs-dismiss="alert"></button>
        </div>
        {% endfor %}
    </div>
    {% endif %}

    <!-- 主要内容容器：增加内边距和背景适配 -->
    <div class="container mt-4 base-content-container">
        {% block content %}
        {% endblock %}
    </div>

    <!-- 底部版权信息（新增，提升完整性） -->
    <footer class="base-footer mt-8 py-4">
        <div class="container text-center">
            <p class="text-muted mb-0">© 2025 ExamPulse 智能考研成绩分析系统 | 马卡龙风格设计</p>
        </div>
    </footer>

    <!-- 基础JS（保留原有顺序） -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- 基础交互JS -->
    <script src="/static/users/js/base-script.js"></script>
    {% block extra_js %}{% endblock %}
</body>
</html>